Skip to content

Conversation

@clydin
Copy link
Member

@clydin clydin commented Oct 21, 2025

This commit refactors the find_examples MCP tool to be version-aware, aligning its behavior with the get_best_practices tool. The tool now dynamically resolves the code examples database from the user's installed version of @angular/core, ensuring that the provided examples are accurate for their specific project version.

Key changes:

  • The input schema is updated to accept a workspacePath.
  • New logic reads the angular.examples metadata from @angular/core/package.json to locate the version-specific SQLite database.
  • If the version-specific database cannot be resolved, the tool gracefully falls back to the generic database bundled with the CLI.
  • The database querying logic has been extracted into a separate helper function for better code organization.

This commit refactors the `find_examples` MCP tool to be version-aware, aligning its behavior with the `get_best_practices` tool. The tool now dynamically resolves the code examples database from the user's installed version of `@angular/core`, ensuring that the provided examples are accurate for their specific project version.

Key changes:
- The input schema is updated to accept a `workspacePath`.
- New logic reads the `angular.examples` metadata from `@angular/core/package.json` to locate the version-specific SQLite database.
- If the version-specific database cannot be resolved, the tool gracefully falls back to the generic database bundled with the CLI.
- The database querying logic has been extracted into a separate helper function for better code organization.
@clydin clydin added the target: major This PR is targeted for the next major release label Oct 21, 2025
@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: @angular/cli labels Oct 21, 2025
…error

This commit fixes a runtime error in the `find_examples` tool that occurred when filtering examples. The error `no such column: experimental` was caused by an incorrect SQL query that attempted to access a column on the FTS virtual table (`examples_fts`) that only exists on the main content table (`examples`).

The fix refactors the database query to use a `JOIN` between the `examples` and `examples_fts` tables. This allows the `WHERE` clause to correctly filter on the `experimental` column from the main table while still leveraging the full-text search capabilities of the virtual table.
This commit fixes a bug in the YAML frontmatter parsing logic that caused string values in arrays to be double-quoted. The issue was present in both the `find_examples` MCP tool's runtime parser and the `example_db_generator.js` script.

The `parseFrontmatter` function in both files has been updated to correctly unquote string values, ensuring that the structured data in the examples database is clean and the tool's output is formatted correctly.
@clydin clydin marked this pull request as ready for review October 21, 2025 17:44
@clydin clydin added the action: merge The PR is ready for merge by the caretaker label Oct 22, 2025
@clydin clydin merged commit 122a8c0 into angular:main Oct 22, 2025
32 checks passed
@clydin clydin deleted the mcp/examples-version-aware branch October 22, 2025 00:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/cli detected: feature PR contains a feature commit target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants